# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=perl-net-cidr
_pkgname=Net-CIDR
pkgver=0.21
pkgrel=5
pkgdesc='Manipulate IPv4/IPv6 netblocks in CIDR notation.'
arch=('any')
license=('PerlArtistic' 'GPL')
options=('!emptydirs')
depends=('perl')
url='http://search.cpan.org/dist/Net-CIDR'
source=("http://search.cpan.org/CPAN/authors/id/M/MR/MRSAM/$_pkgname-$pkgver.tar.gz")
sha512sums=('28e7c808173d87a403ab6d924763bdeeef61801775167a11b02bf352d70808821f896f7e3dbb1fd3cd2b42c937f9c6175d1522daddf38c53ee9d242d1a3b5fd1')

# Function to change to the working directory and set
# environment variables to override undesired options.
_enviro() {
  cd "$_pkgname-$pkgver"

  export \
    PERL_MM_USE_DEFAULT=1 \
    PERL_AUTOINSTALL=--skipdeps \
    PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'" \
    PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \
    MODULEBUILDRC=/dev/null
}

build() {
  _enviro

  /usr/bin/perl Makefile.PL

  make
}

package() {
  _enviro

  make install

  find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}

